package com.group.elmboot.service.impl;

import java.util.List;

import com.group.elmboot.mapper.BusinessMapper;
import com.group.elmboot.po.Business;
import com.group.elmboot.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BusinessServiceImpl implements BusinessService {
	
	@Autowired
	private BusinessMapper businessMapper;

	@Override
	public List<Business> listBusinessByOrderTypeId(Integer orderTypeId) {
		return businessMapper.listBusinessByOrderTypeId(orderTypeId);
	}
	
	@Override
	public Business getBusinessById(Integer businessId) {
		return businessMapper.getBusinessById(businessId);
	}
	
	@Override
	public List<Business> getBusinessOrderBySalesDesc(){
		return businessMapper.getBusinessOrderBySalesDesc();
	}
	
	@Override
	public int updateBusinessInfo(Business business){
		return businessMapper.updateBusinessInfo(business);
	}
	
	@Override
	public int insertBusinessInfo(Business business){
		return businessMapper.insertBusinessInfo(business);
	}
	
	@Override
	public List<Business> listBusinessByManagerId(String manager){
		return businessMapper.listBusinessByManagerId(manager);
	}
	
	@Override
	public int deleteBusinessById(Integer businessId) {
		return businessMapper.deleteBusinessById(businessId);
	}
	
	@Override
	public List<Business> listBusinessByConditions(Business business) {
		return businessMapper.listBusinessByConditions(business);
	}
	
	@Override
	public int checkBusinessNameDuplicate(Business business) {
		if(business.getBusinessId()!=null)
			return businessMapper.checkBusinessNameDuplicate(business);
		return businessMapper.checkBusinessNameDuplicateNull(business);
	}
	
	@Override
	public List<Business> searching(String searching){
		return businessMapper.searching("%"+searching+"%");
	}
}
